package com.lsh.oms.core.utils;

import com.lsh.base.common.model.CommonResult;
import com.lsh.oms.core.constant.ReturnCode;

/**
 * Project Name: lsh-oms
 * Created by peter on 17/3/24.
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
public class CommonResultUtils {

    public static CommonResult<Object> commonResult(String code, String message, Object data){

        return new CommonResult<>(code,message,data);
    }

    public static CommonResult<Object> commonResult(String code, String message){

        return new CommonResult<>(code,message);
    }

    public static CommonResult commonResultFalse(String code, String message){

        return new CommonResult<>(code,message,false);
    }

    public static CommonResult commonResultFalse(String message){

        return new CommonResult<>(ReturnCode.REQUEST_FAIL,message,false);
    }

    public static CommonResult commonResultFalse(){

        return new CommonResult<>(ReturnCode.REQUEST_FAIL,"",false);
    }

    public static CommonResult commonResultSuccess(String code, String message){

        return new CommonResult<>(code,message,true);
    }

    public static CommonResult commonResultSuccess(String message){

        return new CommonResult<>(ReturnCode.REQUEST_SUCCESS,message,true);
    }

    public static CommonResult commonResultSuccess(){

        return new CommonResult<>(ReturnCode.REQUEST_SUCCESS,"",true);
    }
}
